<css href="__PUBLIC__/boot-date/css/bootstrap-datetimepicker.min.css" />
<form  method="post" class="form-horizontal">
    <input type="hidden" name="id" value="{$race.id}">
    <div class="form-group">
        <label class="col-md-3 col-xs-12 control-label"></label>
        <div class="col-md-6 col-xs-12">
            <h2>设置为裁判</h2>
        </div>
    </div>
    <input type="hidden" name="user_id" value="{$user_id}">

    <div class="form-group">
        <label class="col-md-3 col-xs-12 control-label">用户昵称</label>
        <div class="col-md-6 col-xs-12">
            <input  type="text" class="form-control" value="{$user.nickname}" readonly/>
        </div>
    </div>

    <div class="form-group">
        <label class="col-md-3 col-xs-12 control-label">微信号</label>
        <div class="col-md-6 col-xs-12">
            <input  type="text" class="form-control" value="{$user.wechat_number}" readonly/>
        </div>
    </div>

    <div class="form-group">
        <label class="col-md-3 col-xs-12 control-label">手机号</label>
        <div class="col-md-6 col-xs-12">
            <input type="text" class="form-control" value="{$user.phone}" readonly/>
        </div>
    </div>

    <div class="form-group">
        <label class="col-md-3 col-xs-12 control-label">登录名</label>
        <div class="col-md-6 col-xs-12">
            <input name="username" type="text" id="username" class="form-control" />
        </div>
    </div>

    <div class="form-group">
        <label class="col-md-3 col-xs-12 control-label">密码</label>
        <div class="col-md-6 col-xs-12">
            <input name="password" type="password"  class="form-control"/>
        </div>
    </div>

    <div class="form-group">
        <label class="col-md-3 col-xs-12 control-label">确认密码</label>
        <div class="col-md-6 col-xs-12">
            <input name="re_password" type="password"  class="form-control"/>
        </div>
    </div>

    <div>
        <div class="col-md-3 col-xs-12"></div>
        <div class="col-md-6 col-xs-12">
            <present name="errorNote">
                <div class="alert alert-danger" role="alert">
                    <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <strong>{$errorNote}</strong>
                </div>
            </present>
            <div class="form-group">
                <div class="col-md-6"><input type="reset" class="btn btn-block btn-default" value=" 清 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 空 " /></div>
                <div class="col-md-6"><button type="button" class="btn btn-block btn-info pull-right" onclick="save()"> 提 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 交 </button></div>
            </div>
        </div>
    </div>
    <!-- Modal -->
    <div class="modal fade" id="hint_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title" id="myModalLabel">提示</h4>
                </div>
                <div class="modal-body" id="hint_content">
                </div>
                <div class="modal-footer">
                    <button type="button" id="close_btn" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <!--<button type="button" class="btn btn-primary">Save changes</button>-->
                </div>
            </div>
        </div>
    </div>
</form>
<script type="text/javascript">
    function save() {
        $.ajax({
            type: "POST",
            url: '__APP__/Admin/User/ajaxSetReferee',
            data: $('form').serialize(),
            dataType: "json",
            success: function (data) {
                console.info(data);
                $("#hint_content").empty().append(data.message);
                $("#hint_modal").modal();
                if(data.success){
                    $('#close_btn').attr('onclick','jump()');
                }
            },
            error: function (data) {
                console.info(data);
                $("#hint_content").empty().append("请求超时！");
                $("#hint_modal").modal();
            }
        });
    }
    function jump() {
        window.location = '__URL__/';
    }
</script>